package pikes.mock;

import java.util.HashMap;

import org.custommonkey.xmlunit.Diff;
import org.junit.Assert;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

import pikes.core.TextView;

public class XMLRenderingTest {

	public static void assertRendering(TextView page, String renderedText) throws Exception {
		MockHttpServletResponse response = new MockHttpServletResponse();

		page.render(new HashMap(), new MockHttpServletRequest(), response);

		Diff diff = new Diff(renderedText, response.getContentAsString());
		Assert.assertTrue(diff.toString(),diff.identical());
	}

}
